FloatingClient

@objc(LSFloatingClient)
class FloatingClient : BaseManager
extension FloatingClient : CVarArg, CustomDebugStringConvertible, CustomStringConvertible, Equatable, Hashable, NSObjectProtocol

Entry point to the LicenseSpring SDK Class for performing basic requests to LicenseSpring floating server

  • Init FloatingClient with configuration.

    Throws

    LSError if the configuration is invalid or the client cannot be initialized.

    Note

    In Objective-C, pass an instance conforming to the LSBaseStorage protocol for baseStorage. In Swift, pass an instance conforming to BaseStorage.

    Declaration

    Swift

    @objc
    init(configuration: Configuration, baseStorage: AnyObject? = nil) throws

    Parameters

    configuration

    Configuration of FloatingClient.

    baseStorage

    An optional object used for low-level data storage operations such as reading, writing, and deleting raw license data. Accepts either a Swift implementation conforming to BaseStorage or an Objective-C object conforming to LSBaseStorage. If nil, the default internal file-based storage is used. This parameter is primarily intended for advanced customization of how license files are persisted.

  • Activated License or nil if no license is active.

    Declaration

    Swift

    @objc
    var currentLicense: License? { get }
  • Base Storage object passed by the user for custom license storage implementation

    Declaration

    Swift

    let baseStorage: any BaseStorage
  • Register client with given id.

    Send register license request to the Floating server.

    Throws

    LSError if registration fails.

    Declaration

    Swift

    @objc
    func register(userID: String) throws -> License

    Parameters

    userID

    User or instance id for license registration, it can be anything - email, host or domain name, handle, etc.

    Return Value

    Shared pointer to License if registration succeeded, throws exceptions in case of errors.

  • Unregister client with given id.

    Throws

    LSError if unregistration fails.

    Declaration

    Swift

    @objc
    func unregister(userID: String) throws
  • Remove license file and internal SDK files if any of them exist.

    Note

    Typically should be called after license deactivation in the app uninstaller.

    Throws

    Error if clearing fails.

    Declaration

    Swift

    @objc
    func clearLocalStorage() throws
  • Helper method to check connection to the Floating server.

    Declaration

    Swift

    @objc
    func checkConnection() -> Bool

    Return Value

    true if SDK is able to connect to the Floating server and false otherwise.

  • Authenticates a user on Floating Server V2 and caches the JWT token.

    Use this before performing any other Floating Server V2 operations. This method only works with Floating Server V2 and will throw if used against a non-V2 server.

    Throws

    LSError if input is invalid or authentication fails.

    Declaration

    Swift

    @objc
    func authenticateUser(user: String, password: String) throws

    Parameters

    user

    The username of the Floating Server V2 account.

    password

    The corresponding password for authentication.

  • Registers a floating license on Floating Server V2.

    The server assigns the client a floating session associated with a specific license ID and optional user (client) ID.

    Throws

    LSError if the input is invalid or registration fails.

    Declaration

    Swift

    func register(userID: String? = nil, licenseId: LicenseIDObjc) throws -> License

    Parameters

    userID

    A client ID to associate with the floating license. If omitted, falls back to currentLicense.floatingClientId.

    licenseId

    The license to register for Floating Server V2.

    Return Value

    The updated License object returned by the server.

  • Retrieves floating license information from Floating Server V2.

    Throws

    LSError if retrieval or JSON parsing fails.

    Declaration

    Swift

    @objc
    func getLicenseInfo(licenseId: LicenseIDObjc? = nil) throws -> License

    Parameters

    licenseId

    Optional license identifier to query. If omitted, all information for the current license is returned.

    Return Value

    A fully constructed License instance populated from server data.

  • Retrieves all active floating license IDs from Floating Server V2.

    Throws

    LSError if the request fails.

    Declaration

    Swift

    @objc
    func getAllLicenses() throws -> [LicenseIDObjc]

    Return Value

    An array of active LicenseIDObjc values available to the user.

  • Borrows a floating license until a specific expiration date.

    This locks the license for the given user until at least the provided date. The server may return a later time depending on its rules.

    Throws

    LSError if the request fails or input is invalid.

    Declaration

    Swift

    @objc
    func borrow(userID: String, licenseId: LicenseIDObjc, until date: Date) throws -> String

    Parameters

    userID

    The floating client ID associated with the borrowing user.

    licenseId

    The license ID to borrow.

    Return Value

    A string representing the actual borrow expiration time returned by the server.

  • Undocumented

    Declaration

    Swift

    @objc
    func getToken() throws -> JwtToken
  • Undocumented

    Declaration

    Swift

    @objc
    func saveToFile() throws